<template>
	<el-tabs v-model="activeName" :tab-position="tabPosition">
		<el-tab-pane v-for="(struct, index) in structData.tabStruct" :key="index" :label="struct.structName" :name="struct.structId + '-' + struct.structName">
			<template v-if="struct.url !== undefined && struct.url != ''">
				<!-- <component
                      :is="structData.url"
                      :formDate="formData"
                    /> -->
			</template>
			<template v-else>
				<!-- <PPMForm :structData="struct" :formData="formData" :ruleData="ruleData"> </PPMForm> -->
				<component :is='proName' :structData="struct" :formData="formData" :ruleData="ruleData"></component>
			</template>
		</el-tab-pane>
	</el-tabs>
</template>

<script>
export default {
	name: "PPMTab",
	props: {
		formData: {
			type: Object,
		},
		ruleData: {
			type: Object,
		},
		structData: {
			type: Object,
		},
	},
	data() {
		return {
			//标签方向:top头部,right右边,bottom底部,left左边
			tabPosition: "top",
			activeName: "",
			proName:"",
		};
	},
	components: {
		PPMForm: () => import("./ppmForm"),
		//rentList: () => import("./rentList"),
	},
	created() {
		this.load();
		this.proName = sessionStorage.getItem('proName')||'PPMForm'
	},
	mounted() {
		if (this.structData.tabStruct !== undefined && this.structData.tabStruct.length >= 1) {
			this.activeName = this.structData.tabStruct[0].structId + "-" + this.structData.tabStruct[0].structName;
		}
	},
	methods: {
		load() {
			//验证规则匹配
			if (this.structData.tabStruct != null && this.structData.tabStruct.length > 0) {
				this.structData.tabStruct.forEach((tab) => {
					if (tab.covertName !== undefined && tab.covertName != "") {
						//tab.covertName作为属性调用后台接口，返回tabName,给tab.structName赋值
					}
				});
			}
			// 
		},
	},
};
</script>

<style></style>
